<!DOCTYPE html>
<html lang="en" xmlns:v-on="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="../../js/vue.js"></script>
</head>
<body>
<div id="id_div">
    计数器：<span>{{num}}</span><br/>
    <button v-on:click="addNum">+</button>
    <button v-on:click="decNum">-</button>
</div>
<script>
    const app=new Vue({
        el:"#id_div",
        data:{
            num:0
        },
        methods:{
            addNum:function () {
                this.num++;
            },
            decNum:function () {
                this.num--;
            }
        }
    })
</script>
</body>
</html>